<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/searchPurchaseOrders.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
function submitPage()
{
    var vendorNameValue = document.purchaseOrderForm.vendor_id.value;
    var errorIndex = document.getElementById("errorIndex");
    var errors = '';
    var chiptracErrors = document.getElementById("chiptracErrors");
    var chiptracInfo = document.getElementById("chiptracInfo");

    chiptracErrors.innerHTML = '';
    chiptracInfo.innerHTML = '';

    if( vendorNameValue == -1 )
    {
        errors = '<li>Please select a vendor</li>'
    }
    if( errors != '' )
    {
        errorIndex.innerHTML = errors;
        return;
    }

	if( document.purchaseOrderForm.poType.value == 1 )
	{
		document.purchaseOrderForm.action = '<%=chipTracContext%>/openPurchaseOrder.do?action=new&path=create';
	}
	else
	{
		document.purchaseOrderForm.action = '<%=chipTracContext%>/purchaseOrders.do?action=new&openPurchaseOrder_Id=-1';
	}
    document.purchaseOrderForm.submit();
}

function createManufacturingPOFromOpenPO()
{
    //document.purchaseOrderForm.action.value="OpenPOSearch";
	document.purchaseOrderForm.action = '<%=chipTracContext%>/searchPurchaseOrders.do?action=OpenPOSearch';
    document.purchaseOrderForm.submit();
}

function showPoForViewPrint( purchaseOrderId)
{
    var poViewURL = '<%=chipTracContext%>/openPurchaseOrder.do?action=printerFriendly&purchaseOrderId='+ purchaseOrderId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function showStaPoForViewPrint( purchaseOrderId, vendorId)
{
    var poViewURL = '<%=chipTracContext%>/purchaseOrders.do?action=printerFriendly&purchaseOrderId='+ purchaseOrderId+'&vendorId='+ vendorId;
    newWindow = window.open (poViewURL,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,resizable=yes');
    newWindow.focus();
}

function ExportToExcel()
{
   document.purchaseOrderForm.action = '<%=chipTracContext%>/purchaseOrders.do?action=savePOReport';
   document.purchaseOrderForm.submit();
}

</script>

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

        <!-- Side Navigation start -->
            <%@include file="/jsp/finance/purchase_order_menu.jsp" %>
        <!-- End of the side navigations -->

        <TD bgcolor="#ffffff">
            <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
<!-- from here your body starts -->
<html:form name="purchaseOrderForm" type="com.scalar.chiptrack.finance.openpo.forms.purchaseOrderForm" action="/searchPurchaseOrders.do">

            <table border="0" align = "center" width ="90%" bordercolor='red'>
                <tr><td colspan="4" class="NArialW" align="center">Create Purchase Order</td></tr>
                <tr><td colspan="4">&nbsp;&nbsp;</td></tr>
				<tr><td colspan="4" id="chiptracErrors"><chiptrack:errors styleClass="NArialL"/></td></tr>
				<tr><td colspan="4" id="chiptracInfo"><chiptrack:info styleClass="NArialL"/></td></tr>
				<tr><td colspan="4" id="errorIndex" style='color:#FF0000' class='NArialL'></td></tr>
				<tr><td colspan="4">&nbsp;&nbsp;</td></tr>
                <tr>
                    <td width="25%"><font class = "NArialL">Vendor Name</font></td>
                    <td width="25%">
                        <html:select property="vendor_id" styleClass="txfield">
							<option value="-1">--Select Vendor-- </option>
                            <html:options collection = "vendorsList" property="value" labelProperty="label"/>
                        </html:select>
                    </td>
                    <td  width="25%"><font class = "NArialL">PO Type</font></td>
                    <td  width="25%">
                        <html:select property="poType" styleClass="txfield">
                            <html:options collection = "purchaseOrderTypesList" property="label" labelProperty="value"/>
                        </html:select>
                    </td>
                </tr>
                <tr><td colspan="4">&nbsp;&nbsp;</td></tr>

                <%--<tr>
                    <td colspan="3">&nbsp;&nbsp;</td>
                    <td> <a class="NArialL" href="javascript:ExportToExcel()" onMouseOver="window.status='Click here to Export to Excel';return true" onMouseOut="window.status='';return true" title='Click here to Export to Excel' >Export to Excel</a></td>
                </tr>--%>
                <%--<tr>
                    <td colspan="2">&nbsp;</td>
                    <td colspan = '2' align = "center">
                        <a href="javascript:createManufacturingPOFromOpenPO()" class='NArialS' href="" onMouseOver="window.status='Click here to get the ...';return true" onMouseOut="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/spacer.gif' border='0' height='1' width='1'><b>[Create Standard PO from Open PO]</b></a>
                    </td>
                </tr>--%>
                <tr><td  colspan="4">&nbsp;&nbsp;</td></tr>
                <TR align = "center" border="0">
                <TD  bgColor= "" align="center" colspan = '4'>
                    <A href="javascript:submitPage()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Create PO';return true" onmouseout="window.status='';return true" title="Click here to Create PO"></A>&nbsp;&nbsp;&nbsp;
                    <A href="javascript:document.purchaseOrderForm.reset()" onMouseOver="window.status='Click to Reset the PO Information';return true" onMouseOut="window.status='';return true" title="Click here to Reset Process Information"><IMG border=0 src="<%=chipTracContext%>/jsp/includes/images/reset.gif"></a>
                </TD>
                </TR>
            </table>

</html:form>
<BR><BR><BR>
        </TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>

